function Cache(size) {
	this.size = size;
		
	this.clear = function() {
		this.size = this.size || 16;
		this.index = 0;
		this.keys = new Array(this.size);
		this.cache = new Array(this.size);
	};
	
	this.put = function(key, value) {
		if (!this.update(key, value)) {
			return this.insert(key, value);
		}
	};
	
	this.insert = function(key, value) {
		if (this.isCached(key)) {
			return false;
		}
		
		this.keys[key] = this.index;
		this.cache[this.index] = value;
		
		this.index = (this.index + 1) % this.size;
		
		return true;
	}
	
	this.get = function(key) {
		return this.cache[this.keys[key]] || null;
	};
	
	this.isCached = function(key) {
		return !!this.cache[this.keys[key]];
	};
	
	this.update = function(key, value) {
		if (!this.isCached(key)) {
			return false;
		}
		
		this.cache[this.keys[key]] = value;
		
		return true;
	};
	
	this.clear();
}